package com.aixin.csopuser.repository;

import com.aixin.csopsupplier.domain.ServiceDef;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface ServiceDefineRepository extends JpaRepository<ServiceDef, Long>, JpaSpecificationExecutor<ServiceDef> {

    @Query(value = "select sd from ServiceDef sd join ServiceLevelDef sld on sd.serviceID=sld.serviceID " +
            "where sld.equityID=:equityID and sld.equityLevelID=:equityLevelID")
    List<ServiceDef> findEquityServices(@Param("equityID") String equityID, @Param("equityLevelID") String equityLevelID);

    List<ServiceDef> findAllByServiceStatusLessThan(Integer status);
}
